package com.ytjj.qmyx.admin.controller;

import com.ytjj.common.api.CommonResult;
import com.ytjj.qmyx.admin.annotation.OperLog;
import com.ytjj.qmyx.admin.constants.SysLogConstants;
import com.ytjj.qmyx.admin.model.request.RechargeRequest;
import com.ytjj.qmyx.admin.service.RechargeService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 *
 *  *
 *
 * 充值 管理
 **/
@RequestMapping("/recharge")
@RestController
public class RechargeController {

    @Resource
    private RechargeService rechargeService;

    /**
     * 获取需要充值的列表
     * @param rechargeRequest
     * @return
     */
    @GetMapping("/list")
    @OperLog(operModule = "充值管理", operDesc = "充值列表", operType = SysLogConstants.OPERATION_SELECT)
    public CommonResult list(RechargeRequest rechargeRequest) {
        return CommonResult.page(rechargeService.list(rechargeRequest));
    }

    /**
     * 充值
     * @param id
     * @return
     */
    @GetMapping("/add")
    @OperLog(operModule = "充值管理", operDesc = "充值", operType = SysLogConstants.OPERATION_ADD)
    public CommonResult add(@RequestParam Integer id) {
        rechargeService.add(id);
        return CommonResult.success();
    }
}
